<template>
	<view class="custom-class empty w100">
		<view class="empty__image"><slot name="image"></slot></view>
		<view class="empty__image"><image v-if="image" class="empty__image__img" :src="$assets.img(image)" /></view>

		<view class="empty__description txt-breakall"><slot name="description"></slot></view>
		<view v-if="description && description.length > 0" class="empty__description txt-breakall">
			<u-parse :html="description" :selectable="false" :autosetTitle="false"></u-parse>
		</view>
		
		<view class="empty__bottom"><slot></slot></view>
	</view>
</template>

<script>
export default {
	name: 'empty',
	props: {
		description: {
			type: String,
			default: null
		},
		image: {
			type: String,
			default: '/static/images/common/empty-icon.png'
		}
	}
};
</script>

<style scoped>
.empty {
	display: -webkit-flex;
	display: flex;
	-webkit-flex-direction: column;
	flex-direction: column;
	-webkit-align-items: center;
	align-items: center;
	-webkit-justify-content: center;
	justify-content: center;
	box-sizing: border-box;
	padding: 64rpx 0;
}
.empty__image {
	width: 320rpx;
	height: 320rpx;
}
.empty__image:empty {
	display: none;
}
.empty__image__img {
	width: 100%;
	height: 100%;
}
.empty__image:not(:empty) + .empty__image {
	display: none;
}
.empty__description {
	margin-top: 32rpx;
	padding: 0 60rpx;
	color: #969799;
	font-size: 28rpx;
	line-height: 42rpx;
	text-align: center;
}
.empty__description:empty,
.empty__description:not(:empty) + .empty__description {
	display: none;
}
.empty__bottom {
	margin-top: 48rpx;
}
</style>
